# 账号表序列化器
from rest_framework import serializers

from apps.common.account.models import Account


class AccountSerializer(serializers.ModelSerializer):
    created_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M", required=False, read_only=True)
    updated_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M", required=False, read_only=True)

    class Meta:
        model = Account
        fields = (
            'id','type', 'username', 'realname', 'faculty_title', 'grade_name', 'class_title', 'telephone', 'status',
            'created_time', 'updated_time')

class AccountListSerializer(serializers.ModelSerializer):
    class Meta:
        model = Account
        fields = ('id','realname', 'username',)

